var formcontent;

$(function () {
    initThisPage()
})

function initThisPage() {
    var ID = oneValues();
    var jsondata = {"ID":ID};
    var data_json = JSON.stringify(jsondata)
    $.ajax({
        url: "./goPCDD/initCarInfo", //请求的url地址
        dataType: "json", //返回格式为json
        async:false,
        data: data_json, //参数值
        type: "POST", //请求方式
        processData: false, //对表单data数据是否进行序列化
        contentType: false, //dataType设置你收到服务器数据的格式
        headers: {
            'Content-Type': 'application/json'
        },
        success: function(data) {
            formcontent = JSON.parse(data.data);
            var vm = new Vue({
                el: "#app",
                data: function () {
                    return {
                        formItem:{
                            CarNo:formcontent.CarNo,
                            CarType:formcontent.CarType,
                            CarBrand:formcontent.CarBrand,
                            CarTypeNo:formcontent.CarTypeNo,
                            CarSBNo:formcontent.CarSBNo,
                            EngineNo:formcontent.EngineNo,
                            RecordDate:formcontent.RecordDate,
                            HaveLicenseDate:formcontent.HaveLicenseDate,
                            RecordNo:formcontent.RecordNo,
                            LoadNumber:formcontent.LoadNumber,
                            InspectionPeriod:formcontent.InspectionPeriod,
                            CarStatus:formcontent.CarStatus,
                            UseStatus:formcontent.UseStatus,
                            Mileage:formcontent.Mileage,
                            HandOrAuto:formcontent.HandOrAuto,
                            CarInfos:formcontent.CarInfos,
                        },
                        stripe: true
                    }
                },
                methods: {
                    goBack(){
                        window.location.href = "./car_search.html"
                    },
                }
            })

        },
        error: function() {
            toastr.error('删除失败，请刷新页面');
        },
    });
}


function oneValues(){
    var result;
    var url=window.location.search; //获取url中"?"符后的字串
    if(url.indexOf("?")!=-1){
        result = url.substr(url.indexOf("=")+1);
    }
    return result;
}